﻿﻿using System;
using System.Collections.Generic;
using System.Text;
namespace WebApp.App.Models.Entity.Common
{
    public class site:NRapid.Struct
    {
		public System.Int64 id;
		public System.String name;
		public System.Int64? channel_id;
		public System.String subdomain_name;
		public System.String title;
		public System.String company;
		public System.String address;
		public System.String tel;
		public System.String fax;
		public System.String email;
		public System.String copyright;
		public System.String seo_folder;
		public System.String seo_title;
		public System.String seo_keyword;
		public System.String seo_description;
		public System.Int16? is_default;
		#region 从get列表初始化实体类
		public static bool TryParse(NRapid.NameValueCollection get,out site par)
		{
			par=new site();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.name=get["name"];
						par.channel_id=null;
						if(get["channel_id"]!=null)
						{
							par.channel_id=System.Int64.Parse(get["channel_id"]);
						}
						par.subdomain_name=get["subdomain_name"];
						par.title=get["title"];
						par.company=get["company"];
						par.address=get["address"];
						par.tel=get["tel"];
						par.fax=get["fax"];
						par.email=get["email"];
						par.copyright=get["copyright"];
						par.seo_folder=get["seo_folder"];
						par.seo_title=get["seo_title"];
						par.seo_keyword=get["seo_keyword"];
						par.seo_description=get["seo_description"];
						par.is_default=null;
						if(get["is_default"]!=null)
						{
							par.is_default=System.Int16.Parse(get["is_default"]);
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public override void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"name\":");
					tw.Write("\"");
					tw.Write(name==null?"null":name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"channel_id\":");
					tw.Write(channel_id==null?"null" : channel_id.ToString());
					tw.Write(",");
					tw.Write("\"subdomain_name\":");
					tw.Write("\"");
					tw.Write(subdomain_name==null?"null":subdomain_name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"title\":");
					tw.Write("\"");
					tw.Write(title==null?"null":title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"company\":");
					tw.Write("\"");
					tw.Write(company==null?"null":company);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"address\":");
					tw.Write("\"");
					tw.Write(address==null?"null":address);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"tel\":");
					tw.Write("\"");
					tw.Write(tel==null?"null":tel);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"fax\":");
					tw.Write("\"");
					tw.Write(fax==null?"null":fax);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"email\":");
					tw.Write("\"");
					tw.Write(email==null?"null":email);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"copyright\":");
					tw.Write("\"");
					tw.Write(copyright==null?"null":copyright);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_folder\":");
					tw.Write("\"");
					tw.Write(seo_folder==null?"null":seo_folder);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_title\":");
					tw.Write("\"");
					tw.Write(seo_title==null?"null":seo_title);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_keyword\":");
					tw.Write("\"");
					tw.Write(seo_keyword==null?"null":seo_keyword);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"seo_description\":");
					tw.Write("\"");
					tw.Write(seo_description==null?"null":seo_description);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"is_default\":");
					tw.Write(is_default==null?"null" : is_default.ToString());
			tw.Write("}");
		}
		#endregion
    }
}